public class SortTest {
    public static void main(String[] args) {
        int[] array = {2,5,4,6,7,51,4,9};
        bubbleSort(array);
        for (int temp :
                array) {
            System.out.println(temp);
        }
    }

    public static void bubbleSort(int[] array){
        int length = array.length;
        for (int i = 0; i < length; i++) {
            for (int j = 0; j < length-1; j++) {
                if (array[j] > array[j+1]){
                    int temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                }
            }
        }
    }

}
